<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Module      :  Data.Bits</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2001</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- This module defines bitwise operations for signed and unsigned</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- integers.  Instances of the class 'Bits' for the 'Int' and</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- 'Integer' types are available from this module, and instances for</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- explicitly sized integral types are available from the</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- &quot;Data.Int&quot; and &quot;Data.Word&quot; modules.</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Bits</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>  </span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier">Bits</span></a></span><span class="hs-special">(</span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><a href="Data.Bits.html#.%26."><span class="hs-operator">(.&amp;.)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#.%7C."><span class="hs-operator">(.|.)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#xor"><span class="hs-identifier">xor</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>    </span><span class="annot"><a href="Data.Bits.html#complement"><span class="hs-identifier">complement</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>    </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-identifier">shift</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>    </span><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-identifier">rotate</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><a href="Data.Bits.html#zeroBits"><span class="hs-identifier">zeroBits</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-identifier">bit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="Data.Bits.html#setBit"><span class="hs-identifier">setBit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="Data.Bits.html#clearBit"><span class="hs-identifier">clearBit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>    </span><span class="annot"><a href="Data.Bits.html#complementBit"><span class="hs-identifier">complementBit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-identifier">testBit</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier">bitSizeMaybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="Data.Bits.html#bitSize"><span class="hs-identifier">bitSize</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><a href="Data.Bits.html#isSigned"><span class="hs-identifier">isSigned</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-identifier">shiftL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-identifier">shiftR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><a href="Data.Bits.html#unsafeShiftL"><span class="hs-identifier">unsafeShiftL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#unsafeShiftR"><span class="hs-identifier">unsafeShiftR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-identifier">rotateL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-identifier">rotateR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-identifier">popCount</span></a></span><span>
</span><span id="line-41"></span><span>  </span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>  </span><span class="annot"><a href="Data.Bits.html#FiniteBits"><span class="hs-identifier">FiniteBits</span></a></span><span class="hs-special">(</span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier">finiteBitSize</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><a href="Data.Bits.html#countLeadingZeros"><span class="hs-identifier">countLeadingZeros</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><a href="Data.Bits.html#countTrailingZeros"><span class="hs-identifier">countTrailingZeros</span></a></span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>  </span><span class="annot"><a href="Data.Bits.html#bitDefault"><span class="hs-identifier">bitDefault</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>  </span><span class="annot"><a href="Data.Bits.html#testBitDefault"><span class="hs-identifier">testBitDefault</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>  </span><span class="annot"><a href="Data.Bits.html#popCountDefault"><span class="hs-identifier">popCountDefault</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>  </span><span class="annot"><a href="Data.Bits.html#toIntegralSized"><span class="hs-identifier">toIntegralSized</span></a></span><span>
</span><span id="line-52"></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-comment">-- Defines the @Bits@ class containing bit-based operations.</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- See library document for details on the semantics of the</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- individual operations.</span><span class="hs-cpp">

#include &quot;MachDeps.h&quot;
</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Maybe.html"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Real.html"><span class="hs-identifier">GHC.Real</span></a></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">8</span><span> </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-operator hs-type">`shift`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-operator hs-type">`rotate`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-type">`shiftL`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-type">`shiftR`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-operator hs-type">`rotateL`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-operator hs-type">`rotateR`</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">7</span><span> </span><span class="annot"><a href="Data.Bits.html#.%26."><span class="hs-operator hs-type">.&amp;.</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">6</span><span> </span><span class="annot"><a href="Data.Bits.html#xor"><span class="hs-operator hs-type">`xor`</span></a></span><span>
</span><span id="line-68"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.Bits.html#.%7C."><span class="hs-operator hs-type">.|.</span></a></span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">bitSize</span><span> </span><span class="hs-pragma">&quot;Use 'bitSizeMaybe' or 'finiteBitSize' instead&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- deprecated in 7.8</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- | The 'Bits' class defines bitwise operations over integral types.</span><span>
</span><span id="line-73"></span><span class="hs-comment">--</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- * Bits are numbered from 0 with bit 0 being the least</span><span>
</span><span id="line-75"></span><span class="hs-comment">--   significant bit.</span><span>
</span><span id="line-76"></span><span class="hs-keyword">class</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="Bits"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-var">Bits</span></a></span></span><span> </span><span id="local-6989586621679498332"><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-pragma">{-# MINIMAL</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">.&amp;.</span><span class="hs-pragma">)</span><span class="hs-pragma">,</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">.|.</span><span class="hs-pragma">)</span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#xor"><span class="hs-pragma hs-type">xor</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#complement"><span class="hs-pragma hs-type">complement</span></a></span><span class="hs-pragma">,</span><span>
</span><span id="line-78"></span><span>                </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-pragma hs-type">shift</span></a></span><span> </span><span class="hs-pragma">|</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-pragma hs-type">shiftL</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-pragma hs-type">shiftR</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span class="hs-pragma">,</span><span>
</span><span id="line-79"></span><span>                </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-pragma hs-type">rotate</span></a></span><span> </span><span class="hs-pragma">|</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-pragma hs-type">rotateL</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-pragma hs-type">rotateR</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span class="hs-pragma">,</span><span>
</span><span id="line-80"></span><span>                </span><span class="annot"><a href="Data.Bits.html#bitSize"><span class="hs-pragma hs-type">bitSize</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-pragma hs-type">bitSizeMaybe</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#isSigned"><span class="hs-pragma hs-type">isSigned</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-pragma hs-type">testBit</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-pragma hs-type">bit</span></a></span><span class="hs-pragma">,</span><span> </span><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-pragma hs-type">popCount</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-comment">-- | Bitwise \&quot;and\&quot;</span><span>
</span><span id="line-83"></span><span>    </span><span id=".%26."><span class="annot"><a href="Data.Bits.html#.%26."><span class="hs-operator hs-type">(.&amp;.)</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-comment">-- | Bitwise \&quot;or\&quot;</span><span>
</span><span id="line-86"></span><span>    </span><span id=".%7C."><span class="annot"><a href="Data.Bits.html#.%7C."><span class="hs-operator hs-type">(.|.)</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-comment">-- | Bitwise \&quot;xor\&quot;</span><span>
</span><span id="line-89"></span><span>    </span><span id="xor"><span class="annot"><a href="Data.Bits.html#xor"><span class="hs-identifier hs-type">xor</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-comment">{-| Reverse all the bits in the argument -}</span><span>
</span><span id="line-92"></span><span>    </span><span id="complement"><span class="annot"><a href="Data.Bits.html#complement"><span class="hs-identifier hs-type">complement</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-comment">{-| @'shift' x i@ shifts @x@ left by @i@ bits if @i@ is positive,
        or right by @-i@ bits otherwise.
        Right shifts perform sign extension on signed number types;
        i.e. they fill the top bits with 1 if the @x@ is negative
        and with 0 otherwise.

        An instance can define either this unified 'shift' or 'shiftL' and
        'shiftR', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-103"></span><span>    </span><span id="shift"><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-identifier hs-type">shift</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span>    </span><span id="local-6989586621679498227"><span id="local-6989586621679498217"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498217"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-operator hs-var hs-var">`shift`</span></a></span><span>   </span><span id="local-6989586621679498216"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498216"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498216"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498217"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498216"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498216"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498217"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498216"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-107"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498217"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-comment">{-| @'rotate' x i@ rotates @x@ left by @i@ bits if @i@ is positive,
        or right by @-i@ bits otherwise.

        For unbounded types like 'Integer', 'rotate' is equivalent to 'shift'.

        An instance can define either this unified 'rotate' or 'rotateL' and
        'rotateR', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-117"></span><span>    </span><span id="rotate"><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-identifier hs-type">rotate</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span>    </span><span id="local-6989586621679498213"><span id="local-6989586621679498205"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498205"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-operator hs-var hs-var">`rotate`</span></a></span><span>  </span><span id="local-6989586621679498204"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498204"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498204"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498205"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#rotateR"><span class="hs-operator hs-var">`rotateR`</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498204"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-120"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498204"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498205"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#rotateL"><span class="hs-operator hs-var">`rotateL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498204"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-121"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498205"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-comment">{-
    -- Rotation can be implemented in terms of two shifts, but care is
    -- needed for negative values.  This suggested implementation assumes
    -- 2's-complement arithmetic.  It is commented out because it would
    -- require an extra context (Ord a) on the signature of 'rotate'.
    x `rotate`  i | i&lt;0 &amp;&amp; isSigned x &amp;&amp; x&lt;0
                         = let left = i+bitSize x in
                           ((x `shift` i) .&amp;. complement ((-1) `shift` left))
                           .|. (x `shift` left)
                  | i&lt;0  = (x `shift` i) .|. (x `shift` (i+bitSize x))
                  | i==0 = x
                  | i&gt;0  = (x `shift` i) .|. (x `shift` (i-bitSize x))
    -}</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-comment">-- | 'zeroBits' is the value with all bits unset.</span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-139"></span><span>    </span><span class="hs-comment">-- The following laws ought to hold (for all valid bit indices @/n/@):</span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-comment">--   * @'clearBit' 'zeroBits' /n/ == 'zeroBits'@</span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-comment">--   * @'setBit'   'zeroBits' /n/ == 'bit' /n/@</span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-comment">--   * @'testBit'  'zeroBits' /n/ == False@</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-comment">--   * @'popCount' 'zeroBits'   == 0@</span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-comment">-- This method uses @'clearBit' ('bit' 0) 0@ as its default</span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-comment">-- implementation (which ought to be equivalent to 'zeroBits' for</span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-comment">-- types which possess a 0th bit).</span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-151"></span><span>    </span><span id="zeroBits"><span class="annot"><a href="Data.Bits.html#zeroBits"><span class="hs-identifier hs-type">zeroBits</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-152"></span><span>    </span><span id="local-6989586621679498203"><span class="annot"><a href="Data.Bits.html#zeroBits"><span class="hs-identifier hs-var hs-var">zeroBits</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#clearBit"><span class="hs-identifier hs-var">clearBit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-comment">-- | @bit /i/@ is a value with the @/i/@th bit set and all other bits clear.</span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-comment">-- Can be implemented using `bitDefault' if @a@ is also an</span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-comment">-- instance of 'Num'.</span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-comment">-- See also 'zeroBits'.</span><span>
</span><span id="line-160"></span><span>    </span><span id="bit"><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-identifier hs-type">bit</span></a></span></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>    </span><span class="hs-comment">-- | @x \`setBit\` i@ is the same as @x .|. bit i@</span><span>
</span><span id="line-163"></span><span>    </span><span id="setBit"><span class="annot"><a href="Data.Bits.html#setBit"><span class="hs-identifier hs-type">setBit</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-comment">-- | @x \`clearBit\` i@ is the same as @x .&amp;. complement (bit i)@</span><span>
</span><span id="line-166"></span><span>    </span><span id="clearBit"><span class="annot"><a href="Data.Bits.html#clearBit"><span class="hs-identifier hs-type">clearBit</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-comment">-- | @x \`complementBit\` i@ is the same as @x \`xor\` bit i@</span><span>
</span><span id="line-169"></span><span>    </span><span id="complementBit"><span class="annot"><a href="Data.Bits.html#complementBit"><span class="hs-identifier hs-type">complementBit</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-comment">{-| @x \`testBit\` i@ is the same as @x .&amp;. bit n /= 0@

        In other words it returns True if the bit at offset @n
        is set.

        Can be implemented using `testBitDefault' if @a@ is also an
        instance of 'Num'.
        -}</span><span>
</span><span id="line-179"></span><span>    </span><span id="testBit"><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-identifier hs-type">testBit</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-comment">{-| Return the number of bits in the type of the argument.  The actual
        value of the argument is ignored.  Returns Nothing
        for types that do not have a fixed bitsize, like 'Integer'.

        @since 4.7.0.0
        -}</span><span>
</span><span id="line-187"></span><span>    </span><span id="bitSizeMaybe"><span class="annot"><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-type">bitSizeMaybe</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-comment">{-| Return the number of bits in the type of the argument.  The actual
        value of the argument is ignored.  The function 'bitSize' is
        undefined for types that do not have a fixed bitsize, like 'Integer'.

        Default implementation based upon 'bitSizeMaybe' provided since
        4.12.0.0.
        -}</span><span>
</span><span id="line-196"></span><span>    </span><span id="bitSize"><span class="annot"><a href="Data.Bits.html#bitSize"><span class="hs-identifier hs-type">bitSize</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-197"></span><span>    </span><span id="local-6989586621679498200"><span class="annot"><a href="Data.Bits.html#bitSize"><span class="hs-identifier hs-var hs-var">bitSize</span></a></span><span> </span><span id="local-6989586621679498196"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498196"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int -&gt; Int
forall a. a -&gt; Maybe a -&gt; a
</span><a href="Data.Maybe.html#fromMaybe"><span class="hs-identifier hs-var">fromMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; Int
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;bitSize is undefined&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe Int
forall a. Bits a =&gt; a -&gt; Maybe Int
</span><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-var">bitSizeMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498196"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-comment">{-| Return 'True' if the argument is a signed type.  The actual
        value of the argument is ignored -}</span><span>
</span><span id="line-201"></span><span>    </span><span id="isSigned"><span class="annot"><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-type">isSigned</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#setBit"><span class="hs-pragma hs-type">setBit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#clearBit"><span class="hs-pragma hs-type">clearBit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#complementBit"><span class="hs-pragma hs-type">complementBit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-206"></span><span>    </span><span id="local-6989586621679498193"><span id="local-6989586621679498190"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498190"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#setBit"><span class="hs-operator hs-var hs-var">`setBit`</span></a></span><span> </span><span id="local-6989586621679498189"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498189"><span class="hs-identifier hs-var">i</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498190"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%7C."><span class="hs-operator hs-var">.|.</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498189"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-207"></span><span>    </span><span id="local-6989586621679498188"><span id="local-6989586621679498184"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498184"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#clearBit"><span class="hs-operator hs-var hs-var">`clearBit`</span></a></span><span> </span><span id="local-6989586621679498183"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498183"><span class="hs-identifier hs-var">i</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498184"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Bits a =&gt; a -&gt; a
</span><a href="Data.Bits.html#complement"><span class="hs-identifier hs-var">complement</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498183"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-208"></span><span>    </span><span id="local-6989586621679498182"><span id="local-6989586621679498179"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498179"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#complementBit"><span class="hs-operator hs-var hs-var">`complementBit`</span></a></span><span> </span><span id="local-6989586621679498178"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498178"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498179"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#xor"><span class="hs-operator hs-var">`xor`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498178"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-comment">{-| Shift the argument left by the specified number of bits
        (which must be non-negative). Some instances may throw an
        'Control.Exception.Overflow' exception if given a negative input.

        An instance can define either this and 'shiftR' or the unified
        'shift', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-217"></span><span>    </span><span id="shiftL"><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-identifier hs-type">shiftL</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-218"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-pragma hs-type">shiftL</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-219"></span><span>    </span><span id="local-6989586621679498177"><span id="local-6989586621679498175"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498175"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var hs-var">`shiftL`</span></a></span><span>  </span><span id="local-6989586621679498174"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498174"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498175"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shift"><span class="hs-operator hs-var">`shift`</span></a></span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498174"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-comment">{-| Shift the argument left by the specified number of bits.  The
        result is undefined for negative shift amounts and shift amounts
        greater or equal to the 'bitSize'.

        Defaults to 'shiftL' unless defined explicitly by an instance.

        @since 4.5.0.0 -}</span><span>
</span><span id="line-228"></span><span>    </span><span id="unsafeShiftL"><span class="annot"><a href="Data.Bits.html#unsafeShiftL"><span class="hs-identifier hs-type">unsafeShiftL</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#unsafeShiftL"><span class="hs-pragma hs-type">unsafeShiftL</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-230"></span><span>    </span><span id="local-6989586621679498173"><span id="local-6989586621679498171"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498171"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#unsafeShiftL"><span class="hs-operator hs-var hs-var">`unsafeShiftL`</span></a></span><span> </span><span id="local-6989586621679498170"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498170"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498171"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498170"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span>    </span><span class="hs-comment">{-| Shift the first argument right by the specified number of bits. The
        result is undefined for negative shift amounts and shift amounts
        greater or equal to the 'bitSize'. Some instances may throw an
        'Control.Exception.Overflow' exception if given a negative input.

        Right shifts perform sign extension on signed number types;
        i.e. they fill the top bits with 1 if the @x@ is negative
        and with 0 otherwise.

        An instance can define either this and 'shiftL' or the unified
        'shift', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-244"></span><span>    </span><span id="shiftR"><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-identifier hs-type">shiftR</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-pragma hs-type">shiftR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-246"></span><span>    </span><span id="local-6989586621679498169"><span id="local-6989586621679498166"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498166"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var hs-var">`shiftR`</span></a></span><span>  </span><span id="local-6989586621679498165"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498165"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498166"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shift"><span class="hs-operator hs-var">`shift`</span></a></span><span>  </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498165"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span>    </span><span class="hs-comment">{-| Shift the first argument right by the specified number of bits, which
        must be non-negative and smaller than the number of bits in the type.

        Right shifts perform sign extension on signed number types;
        i.e. they fill the top bits with 1 if the @x@ is negative
        and with 0 otherwise.

        Defaults to 'shiftR' unless defined explicitly by an instance.

        @since 4.5.0.0 -}</span><span>
</span><span id="line-258"></span><span>    </span><span id="unsafeShiftR"><span class="annot"><a href="Data.Bits.html#unsafeShiftR"><span class="hs-identifier hs-type">unsafeShiftR</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-259"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#unsafeShiftR"><span class="hs-pragma hs-type">unsafeShiftR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-260"></span><span>    </span><span id="local-6989586621679498164"><span id="local-6989586621679498162"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498162"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#unsafeShiftR"><span class="hs-operator hs-var hs-var">`unsafeShiftR`</span></a></span><span> </span><span id="local-6989586621679498161"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498161"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498162"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498161"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span>    </span><span class="hs-comment">{-| Rotate the argument left by the specified number of bits
        (which must be non-negative).

        An instance can define either this and 'rotateR' or the unified
        'rotate', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-268"></span><span>    </span><span id="rotateL"><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-identifier hs-type">rotateL</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-269"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-pragma hs-type">rotateL</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-270"></span><span>    </span><span id="local-6989586621679498160"><span id="local-6989586621679498158"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498158"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#rotateL"><span class="hs-operator hs-var hs-var">`rotateL`</span></a></span><span> </span><span id="local-6989586621679498157"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498157"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498158"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#rotate"><span class="hs-operator hs-var">`rotate`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498157"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>    </span><span class="hs-comment">{-| Rotate the argument right by the specified number of bits
        (which must be non-negative).

        An instance can define either this and 'rotateL' or the unified
        'rotate', depending on which is more convenient for the type in
        question. -}</span><span>
</span><span id="line-278"></span><span>    </span><span id="rotateR"><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-identifier hs-type">rotateR</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-279"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-pragma hs-type">rotateR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-280"></span><span>    </span><span id="local-6989586621679498156"><span id="local-6989586621679498153"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498153"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="Data.Bits.html#rotateR"><span class="hs-operator hs-var hs-var">`rotateR`</span></a></span><span> </span><span id="local-6989586621679498152"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498152"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498153"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#rotate"><span class="hs-operator hs-var">`rotate`</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498152"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-comment">{-| Return the number of set bits in the argument.  This number is
        known as the population count or the Hamming weight.

        Can be implemented using `popCountDefault' if @a@ is also an
        instance of 'Num'.

        @since 4.5.0.0 -}</span><span>
</span><span id="line-289"></span><span>    </span><span id="popCount"><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-identifier hs-type">popCount</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498332"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="hs-comment">-- |The 'FiniteBits' class denotes types with a finite, fixed number of bits.</span><span>
</span><span id="line-292"></span><span class="hs-comment">--</span><span>
</span><span id="line-293"></span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-294"></span><span class="hs-keyword">class</span><span> </span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498326"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="FiniteBits"><span class="annot"><a href="Data.Bits.html#FiniteBits"><span class="hs-identifier hs-var">FiniteBits</span></a></span></span><span> </span><span id="local-6989586621679498326"><span class="annot"><a href="#local-6989586621679498326"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-295"></span><span>    </span><span class="hs-comment">-- | Return the number of bits in the type of the argument.</span><span>
</span><span id="line-296"></span><span>    </span><span class="hs-comment">-- The actual value of the argument is ignored. Moreover, 'finiteBitSize'</span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-comment">-- is total, in contrast to the deprecated 'bitSize' function it replaces.</span><span>
</span><span id="line-298"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-299"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-300"></span><span>    </span><span class="hs-comment">-- 'finiteBitSize' = 'bitSize'</span><span>
</span><span id="line-301"></span><span>    </span><span class="hs-comment">-- 'bitSizeMaybe' = 'Just' . 'finiteBitSize'</span><span>
</span><span id="line-302"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-303"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-comment">-- @since 4.7.0.0</span><span>
</span><span id="line-305"></span><span>    </span><span id="finiteBitSize"><span class="annot"><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-type">finiteBitSize</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498326"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-306"></span><span>
</span><span id="line-307"></span><span>    </span><span class="hs-comment">-- | Count number of zero bits preceding the most significant set bit.</span><span>
</span><span id="line-308"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-309"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-310"></span><span>    </span><span class="hs-comment">-- 'countLeadingZeros' ('zeroBits' :: a) = finiteBitSize ('zeroBits' :: a)</span><span>
</span><span id="line-311"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-312"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-313"></span><span>    </span><span class="hs-comment">-- 'countLeadingZeros' can be used to compute log base 2 via</span><span>
</span><span id="line-314"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-315"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-316"></span><span>    </span><span class="hs-comment">-- logBase2 x = 'finiteBitSize' x - 1 - 'countLeadingZeros' x</span><span>
</span><span id="line-317"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-318"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-319"></span><span>    </span><span class="hs-comment">-- Note: The default implementation for this method is intentionally</span><span>
</span><span id="line-320"></span><span>    </span><span class="hs-comment">-- naive. However, the instances provided for the primitive</span><span>
</span><span id="line-321"></span><span>    </span><span class="hs-comment">-- integral types are implemented using CPU specific machine</span><span>
</span><span id="line-322"></span><span>    </span><span class="hs-comment">-- instructions.</span><span>
</span><span id="line-323"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-324"></span><span>    </span><span class="hs-comment">-- @since 4.8.0.0</span><span>
</span><span id="line-325"></span><span>    </span><span id="countLeadingZeros"><span class="annot"><a href="Data.Bits.html#countLeadingZeros"><span class="hs-identifier hs-type">countLeadingZeros</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498326"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-326"></span><span>    </span><span id="local-6989586621679498149"><span class="annot"><a href="Data.Bits.html#countLeadingZeros"><span class="hs-identifier hs-var hs-var">countLeadingZeros</span></a></span><span> </span><span id="local-6989586621679498142"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498142"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498141"><span class="hs-identifier hs-var">w</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679498140"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498141"><span class="hs-identifier hs-var">w</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-327"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-328"></span><span>        </span><span id="local-6989586621679498140"><span class="annot"><span class="annottext">go :: Int -&gt; Int
</span><a href="#local-6989586621679498140"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679498134"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="hs-comment">-- no bit set</span><span>
</span><span id="line-329"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">b -&gt; Int -&gt; Bool
forall a. Bits a =&gt; a -&gt; Int -&gt; Bool
</span><a href="Data.Bits.html#testBit"><span class="hs-identifier hs-var">testBit</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498142"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-330"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679498140"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498134"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span>        </span><span id="local-6989586621679498141"><span class="annot"><span class="annottext">w :: Int
</span><a href="#local-6989586621679498141"><span class="hs-identifier hs-var hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498142"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-333"></span><span>
</span><span id="line-334"></span><span>    </span><span class="hs-comment">-- | Count number of zero bits following the least significant set bit.</span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-336"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-337"></span><span>    </span><span class="hs-comment">-- 'countTrailingZeros' ('zeroBits' :: a) = finiteBitSize ('zeroBits' :: a)</span><span>
</span><span id="line-338"></span><span>    </span><span class="hs-comment">-- 'countTrailingZeros' . 'negate' = 'countTrailingZeros'</span><span>
</span><span id="line-339"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-340"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-341"></span><span>    </span><span class="hs-comment">-- The related</span><span>
</span><span id="line-342"></span><span>    </span><span class="hs-comment">-- &lt;http://en.wikipedia.org/wiki/Find_first_set find-first-set operation&gt;</span><span>
</span><span id="line-343"></span><span>    </span><span class="hs-comment">-- can be expressed in terms of 'countTrailingZeros' as follows</span><span>
</span><span id="line-344"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-345"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-346"></span><span>    </span><span class="hs-comment">-- findFirstSet x = 1 + 'countTrailingZeros' x</span><span>
</span><span id="line-347"></span><span>    </span><span class="hs-comment">-- @</span><span>
</span><span id="line-348"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-349"></span><span>    </span><span class="hs-comment">-- Note: The default implementation for this method is intentionally</span><span>
</span><span id="line-350"></span><span>    </span><span class="hs-comment">-- naive. However, the instances provided for the primitive</span><span>
</span><span id="line-351"></span><span>    </span><span class="hs-comment">-- integral types are implemented using CPU specific machine</span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-comment">-- instructions.</span><span>
</span><span id="line-353"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-comment">-- @since 4.8.0.0</span><span>
</span><span id="line-355"></span><span>    </span><span id="countTrailingZeros"><span class="annot"><a href="Data.Bits.html#countTrailingZeros"><span class="hs-identifier hs-type">countTrailingZeros</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679498326"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-356"></span><span>    </span><span id="local-6989586621679498132"><span class="annot"><a href="Data.Bits.html#countTrailingZeros"><span class="hs-identifier hs-var hs-var">countTrailingZeros</span></a></span><span> </span><span id="local-6989586621679498130"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498130"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679498129"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-357"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-358"></span><span>        </span><span id="local-6989586621679498129"><span class="annot"><span class="annottext">go :: Int -&gt; Int
</span><a href="#local-6989586621679498129"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679498124"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498123"><span class="hs-identifier hs-var">w</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-359"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">b -&gt; Int -&gt; Bool
forall a. Bits a =&gt; a -&gt; Int -&gt; Bool
</span><a href="Data.Bits.html#testBit"><span class="hs-identifier hs-var">testBit</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498130"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-360"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679498129"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498124"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span>        </span><span id="local-6989586621679498123"><span class="annot"><span class="annottext">w :: Int
</span><a href="#local-6989586621679498123"><span class="hs-identifier hs-var hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679498130"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span class="hs-comment">-- The defaults below are written with lambdas so that e.g.</span><span>
</span><span id="line-366"></span><span class="hs-comment">--     bit = bitDefault</span><span>
</span><span id="line-367"></span><span class="hs-comment">-- is fully applied, so inlining will happen</span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-comment">-- | Default implementation for 'bit'.</span><span>
</span><span id="line-370"></span><span class="hs-comment">--</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- Note that: @bitDefault i = 1 `shiftL` i@</span><span>
</span><span id="line-372"></span><span class="hs-comment">--</span><span>
</span><span id="line-373"></span><span class="hs-comment">-- @since 4.6.0.0</span><span>
</span><span id="line-374"></span><span id="local-6989586621679498323"><span class="annot"><a href="Data.Bits.html#bitDefault"><span class="hs-identifier hs-type">bitDefault</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498323"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498323"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498323"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-375"></span><span id="bitDefault"><span class="annot"><span class="annottext">bitDefault :: forall a. (Bits a, Num a) =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bitDefault"><span class="hs-identifier hs-var hs-var">bitDefault</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679498116"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498116"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498116"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-376"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#bitDefault"><span class="hs-pragma hs-type">bitDefault</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-comment">-- | Default implementation for 'testBit'.</span><span>
</span><span id="line-379"></span><span class="hs-comment">--</span><span>
</span><span id="line-380"></span><span class="hs-comment">-- Note that: @testBitDefault x i = (x .&amp;. bit i) /= 0@</span><span>
</span><span id="line-381"></span><span class="hs-comment">--</span><span>
</span><span id="line-382"></span><span class="hs-comment">-- @since 4.6.0.0</span><span>
</span><span id="line-383"></span><span id="local-6989586621679498321"><span class="annot"><a href="Data.Bits.html#testBitDefault"><span class="hs-identifier hs-type">testBitDefault</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498321"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498321"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498321"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span>
</span><span id="line-384"></span><span id="testBitDefault"><span class="annot"><span class="annottext">testBitDefault :: forall a. (Bits a, Num a) =&gt; a -&gt; Int -&gt; Bool
</span><a href="Data.Bits.html#testBitDefault"><span class="hs-identifier hs-var hs-var">testBitDefault</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679498108"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498108"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679498107"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498107"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679498108"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679498107"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-385"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#testBitDefault"><span class="hs-pragma hs-type">testBitDefault</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span class="hs-comment">-- | Default implementation for 'popCount'.</span><span>
</span><span id="line-388"></span><span class="hs-comment">--</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- This implementation is intentionally naive. Instances are expected to provide</span><span>
</span><span id="line-390"></span><span class="hs-comment">-- an optimized implementation for their size.</span><span>
</span><span id="line-391"></span><span class="hs-comment">--</span><span>
</span><span id="line-392"></span><span class="hs-comment">-- @since 4.6.0.0</span><span>
</span><span id="line-393"></span><span id="local-6989586621679498318"><span class="annot"><a href="Data.Bits.html#popCountDefault"><span class="hs-identifier hs-type">popCountDefault</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498318"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498318"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498318"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span></span><span>
</span><span id="line-394"></span><span id="popCountDefault"><span class="annot"><span class="annottext">popCountDefault :: forall a. (Bits a, Num a) =&gt; a -&gt; Int
</span><a href="Data.Bits.html#popCountDefault"><span class="hs-identifier hs-var hs-var">popCountDefault</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a -&gt; Int
forall {t} {t}. (Num t, Num t, Bits t) =&gt; t -&gt; t -&gt; t
</span><a href="#local-6989586621679498099"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-395"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-396"></span><span>   </span><span id="local-6989586621679498099"><span class="annot"><span class="annottext">go :: t -&gt; t -&gt; t
</span><a href="#local-6989586621679498099"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679498087"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498087"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498087"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-397"></span><span>   </span><span class="annot"><a href="#local-6989586621679498099"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679498086"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498086"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679498085"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498085"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
</span><a href="#local-6989586621679498099"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498086"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498085"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679498085"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- clear the least significant</span><span>
</span><span id="line-398"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Bits.html#popCountDefault"><span class="hs-pragma hs-type">popCountDefault</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- | Interpret 'Bool' as 1-bit bit-field</span><span>
</span><span id="line-402"></span><span class="hs-comment">--</span><span>
</span><span id="line-403"></span><span class="hs-comment">--  @since 4.7.0.0</span><span>
</span><span id="line-404"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679498051"><span id="local-6989586621679498053"><span id="local-6989586621679498055"><span id="local-6989586621679498057"><span id="local-6989586621679498059"><span id="local-6989586621679498061"><span id="local-6989586621679498067"><span id="local-6989586621679498069"><span id="local-6989586621679498071"><span id="local-6989586621679498074"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-405"></span><span>    </span><span id="local-6989586621679498048"><span class="annot"><span class="annottext">.&amp;. :: Bool -&gt; Bool -&gt; Bool
</span><a href="#local-6989586621679498048"><span class="hs-operator hs-var hs-var hs-var hs-var">(.&amp;.)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">(&amp;&amp;)</span></a></span><span>
</span><span id="line-406"></span><span>
</span><span id="line-407"></span><span>    </span><span id="local-6989586621679498046"><span class="annot"><span class="annottext">.|. :: Bool -&gt; Bool -&gt; Bool
</span><a href="#local-6989586621679498046"><span class="hs-operator hs-var hs-var hs-var hs-var">(.|.)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">(||)</span></a></span><span>
</span><span id="line-408"></span><span>
</span><span id="line-409"></span><span>    </span><span id="local-6989586621679498043"><span class="annot"><span class="annottext">xor :: Bool -&gt; Bool -&gt; Bool
</span><a href="#local-6989586621679498043"><span class="hs-identifier hs-var hs-var hs-var hs-var">xor</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">(/=)</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span>    </span><span id="local-6989586621679498042"><span class="annot"><span class="annottext">complement :: Bool -&gt; Bool
</span><a href="#local-6989586621679498042"><span class="hs-identifier hs-var hs-var hs-var hs-var">complement</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span>
</span><span id="line-412"></span><span>
</span><span id="line-413"></span><span>    </span><span id="local-6989586621679498037"><span class="annot"><span class="annottext">shift :: Bool -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679498037"><span class="hs-identifier hs-var hs-var hs-var hs-var">shift</span></a></span></span><span> </span><span id="local-6989586621679498036"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498036"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498036"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-414"></span><span>    </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-identifier hs-var">shift</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span>    </span><span id="local-6989586621679498035"><span class="annot"><span class="annottext">rotate :: Bool -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679498035"><span class="hs-identifier hs-var hs-var hs-var hs-var">rotate</span></a></span></span><span> </span><span id="local-6989586621679498034"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498034"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498034"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span>    </span><span id="local-6989586621679498031"><span class="annot"><span class="annottext">bit :: Int -&gt; Bool
</span><a href="#local-6989586621679498031"><span class="hs-identifier hs-var hs-var hs-var hs-var">bit</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-419"></span><span>    </span><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-420"></span><span>
</span><span id="line-421"></span><span>    </span><span id="local-6989586621679498028"><span class="annot"><span class="annottext">testBit :: Bool -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679498028"><span class="hs-identifier hs-var hs-var hs-var hs-var">testBit</span></a></span></span><span> </span><span id="local-6989586621679498027"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498027"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498027"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-422"></span><span>    </span><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-identifier hs-var">testBit</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-423"></span><span>
</span><span id="line-424"></span><span>    </span><span id="local-6989586621679498025"><span class="annot"><span class="annottext">bitSizeMaybe :: Bool -&gt; Maybe Int
</span><a href="#local-6989586621679498025"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSizeMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span>    </span><span id="local-6989586621679498024"><span class="annot"><span class="annottext">bitSize :: Bool -&gt; Int
</span><a href="#local-6989586621679498024"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span>    </span><span id="local-6989586621679498023"><span class="annot"><span class="annottext">isSigned :: Bool -&gt; Bool
</span><a href="#local-6989586621679498023"><span class="hs-identifier hs-var hs-var hs-var hs-var">isSigned</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span>    </span><span id="local-6989586621679498022"><span class="annot"><span class="annottext">popCount :: Bool -&gt; Int
</span><a href="#local-6989586621679498022"><span class="hs-identifier hs-var hs-var hs-var hs-var">popCount</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-431"></span><span>    </span><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-identifier hs-var">popCount</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-432"></span><span>
</span><span id="line-433"></span><span class="hs-comment">-- | @since 4.7.0.0</span><span>
</span><span id="line-434"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Bits.html#FiniteBits"><span class="hs-identifier hs-type">FiniteBits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-435"></span><span>    </span><span id="local-6989586621679498014"><span class="annot"><span class="annottext">finiteBitSize :: Bool -&gt; Int
</span><a href="#local-6989586621679498014"><span class="hs-identifier hs-var hs-var hs-var hs-var">finiteBitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-436"></span><span>    </span><span id="local-6989586621679498013"><span class="annot"><span class="annottext">countTrailingZeros :: Bool -&gt; Int
</span><a href="#local-6989586621679498013"><span class="hs-identifier hs-var hs-var hs-var hs-var">countTrailingZeros</span></a></span></span><span> </span><span id="local-6989586621679498012"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498012"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498012"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-437"></span><span>    </span><span id="local-6989586621679498011"><span class="annot"><span class="annottext">countLeadingZeros :: Bool -&gt; Int
</span><a href="#local-6989586621679498011"><span class="hs-identifier hs-var hs-var hs-var hs-var">countLeadingZeros</span></a></span></span><span>  </span><span id="local-6989586621679498010"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498010"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679498010"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-440"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679497982"><span id="local-6989586621679497984"><span id="local-6989586621679497994"><span id="local-6989586621679497996"><span id="local-6989586621679497998"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-441"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-pragma hs-type">shift</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-442"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-pragma hs-type">bit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-443"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-pragma hs-type">testBit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-444"></span><span>    </span><span class="hs-comment">-- We want popCnt# to be inlined in user code so that `ghc -msse4.2`</span><span>
</span><span id="line-445"></span><span>    </span><span class="hs-comment">-- can compile it down to a popcnt instruction without an extra function call</span><span>
</span><span id="line-446"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-pragma hs-type">popCount</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-447"></span><span>
</span><span id="line-448"></span><span>    </span><span id="local-6989586621679497980"><span class="annot"><span class="annottext">zeroBits :: Int
</span><a href="#local-6989586621679497980"><span class="hs-identifier hs-var hs-var hs-var hs-var">zeroBits</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span>    </span><span id="local-6989586621679497977"><span class="annot"><span class="annottext">bit :: Int -&gt; Int
</span><a href="#local-6989586621679497977"><span class="hs-identifier hs-var hs-var hs-var hs-var">bit</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
forall a. (Bits a, Num a) =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bitDefault"><span class="hs-identifier hs-var">bitDefault</span></a></span><span>
</span><span id="line-451"></span><span>
</span><span id="line-452"></span><span>    </span><span id="local-6989586621679497974"><span class="annot"><span class="annottext">testBit :: Int -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679497974"><span class="hs-identifier hs-var hs-var hs-var hs-var">testBit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. (Bits a, Num a) =&gt; a -&gt; Int -&gt; Bool
</span><a href="Data.Bits.html#testBitDefault"><span class="hs-identifier hs-var">testBitDefault</span></a></span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497973"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497973"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497972"><span class="annot"><span class="annottext">.&amp;. :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497972"><span class="hs-operator hs-var hs-var hs-var hs-var">.&amp;.</span></a></span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497971"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497971"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497973"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#andI%23"><span class="hs-operator hs-var">`andI#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497971"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-455"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497970"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497970"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497969"><span class="annot"><span class="annottext">.|. :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497969"><span class="hs-operator hs-var hs-var hs-var hs-var">.|.</span></a></span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497968"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497968"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497970"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#orI%23"><span class="hs-operator hs-var">`orI#`</span></a></span><span>  </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497968"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497967"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497967"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497966"><span class="annot"><span class="annottext">xor :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497966"><span class="hs-operator hs-var hs-var hs-var hs-var">`xor`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497965"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497965"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497967"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#xorI%23"><span class="hs-operator hs-var">`xorI#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497965"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-457"></span><span>    </span><span id="local-6989586621679497964"><span class="annot"><span class="annottext">complement :: Int -&gt; Int
</span><a href="#local-6989586621679497964"><span class="hs-identifier hs-var hs-var hs-var hs-var">complement</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497963"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497963"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#notI%23"><span class="hs-identifier hs-var">notI#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497963"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-458"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497962"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497962"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497961"><span class="annot"><span class="annottext">shift :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497961"><span class="hs-operator hs-var hs-var hs-var hs-var">`shift`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497960"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497960"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-459"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497960"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497962"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Base.html#iShiftL%23"><span class="hs-operator hs-var">`iShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497960"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-460"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497962"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Base.html#iShiftRA%23"><span class="hs-operator hs-var">`iShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497960"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-461"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497956"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497956"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497955"><span class="annot"><span class="annottext">shiftL :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497955"><span class="hs-operator hs-var hs-var hs-var hs-var">`shiftL`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497954"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497954"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497954"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497956"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Base.html#iShiftL%23"><span class="hs-operator hs-var">`iShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497954"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-463"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-464"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497952"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497952"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497951"><span class="annot"><span class="annottext">unsafeShiftL :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497951"><span class="hs-operator hs-var hs-var hs-var hs-var">`unsafeShiftL`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497950"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497950"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497952"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-operator hs-var">`uncheckedIShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497950"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-465"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497949"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497949"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497948"><span class="annot"><span class="annottext">shiftR :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497948"><span class="hs-operator hs-var hs-var hs-var hs-var">`shiftR`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497947"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497947"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497947"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497949"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="GHC.Base.html#iShiftRA%23"><span class="hs-operator hs-var">`iShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497947"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-467"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-468"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497946"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497946"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497945"><span class="annot"><span class="annottext">unsafeShiftR :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497945"><span class="hs-operator hs-var hs-var hs-var hs-var">`unsafeShiftR`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497944"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497944"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497946"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRA%23"><span class="hs-operator hs-var">`uncheckedIShiftRA#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497944"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#rotate"><span class="hs-pragma hs-type">rotate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>       </span><span class="hs-comment">-- See Note [Constant folding for rotate]</span><span>
</span><span id="line-471"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497943"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497943"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497942"><span class="annot"><span class="annottext">rotate :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679497942"><span class="hs-operator hs-var hs-var hs-var hs-var">`rotate`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497941"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497941"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-472"></span><span>        </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497943"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftL%23"><span class="hs-operator hs-var">`uncheckedIShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497940"><span class="hs-identifier hs-var">i'#</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#orI%23"><span class="hs-operator hs-var">`orI#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497943"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedIShiftRL%23"><span class="hs-operator hs-var">`uncheckedIShiftRL#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497939"><span class="hs-identifier hs-var">wsib</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497940"><span class="hs-identifier hs-var">i'#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-473"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-474"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679497940"><span class="annot"><span class="annottext">i'# :: Int#
</span><a href="#local-6989586621679497940"><span class="hs-identifier hs-var hs-var">i'#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497941"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#andI%23"><span class="hs-operator hs-var">`andI#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497939"><span class="hs-identifier hs-var">wsib</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-475"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679497939"><span class="annot"><span class="annottext">wsib :: Int#
</span><a href="#local-6989586621679497939"><span class="hs-identifier hs-var hs-var">wsib</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WORD_SIZE_IN_BITS#</span><span>   </span><span class="hs-comment">{- work around preprocessor problem (??) -}</span><span>
</span><span id="line-476"></span><span>    </span><span id="local-6989586621679497936"><span class="annot"><span class="annottext">bitSizeMaybe :: Int -&gt; Maybe Int
</span><a href="#local-6989586621679497936"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSizeMaybe</span></a></span></span><span> </span><span id="local-6989586621679497935"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497935"><span class="hs-identifier hs-var">i</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497935"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-477"></span><span>    </span><span id="local-6989586621679497933"><span class="annot"><span class="annottext">bitSize :: Int -&gt; Int
</span><a href="#local-6989586621679497933"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSize</span></a></span></span><span> </span><span id="local-6989586621679497932"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497932"><span class="hs-identifier hs-var">i</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497932"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-478"></span><span>
</span><span id="line-479"></span><span>    </span><span id="local-6989586621679497931"><span class="annot"><span class="annottext">popCount :: Int -&gt; Int
</span><a href="#local-6989586621679497931"><span class="hs-identifier hs-var hs-var hs-var hs-var">popCount</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497930"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497930"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#popCnt%23"><span class="hs-identifier hs-var">popCnt#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497930"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-480"></span><span>
</span><span id="line-481"></span><span>    </span><span id="local-6989586621679497929"><span class="annot"><span class="annottext">isSigned :: Int -&gt; Bool
</span><a href="#local-6989586621679497929"><span class="hs-identifier hs-var hs-var hs-var hs-var">isSigned</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-482"></span><span>
</span><span id="line-483"></span><span class="hs-comment">-- | @since 4.6.0.0</span><span>
</span><span id="line-484"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Bits.html#FiniteBits"><span class="hs-identifier hs-type">FiniteBits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-485"></span><span>    </span><span id="local-6989586621679497923"><span class="annot"><span class="annottext">finiteBitSize :: Int -&gt; Int
</span><a href="#local-6989586621679497923"><span class="hs-identifier hs-var hs-var hs-var hs-var">finiteBitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WORD_SIZE_IN_BITS</span><span>
</span><span id="line-486"></span><span>    </span><span id="local-6989586621679497922"><span class="annot"><span class="annottext">countLeadingZeros :: Int -&gt; Int
</span><a href="#local-6989586621679497922"><span class="hs-identifier hs-var hs-var hs-var hs-var">countLeadingZeros</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497921"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497921"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#clz%23"><span class="hs-identifier hs-var">clz#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497921"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-487"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#countLeadingZeros"><span class="hs-pragma hs-type">countLeadingZeros</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-488"></span><span>    </span><span id="local-6989586621679497920"><span class="annot"><span class="annottext">countTrailingZeros :: Int -&gt; Int
</span><a href="#local-6989586621679497920"><span class="hs-identifier hs-var hs-var hs-var hs-var">countTrailingZeros</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497919"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497919"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#ctz%23"><span class="hs-identifier hs-var">ctz#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497919"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-489"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#countTrailingZeros"><span class="hs-pragma hs-type">countTrailingZeros</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-490"></span><span>
</span><span id="line-491"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-492"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679497889"><span id="local-6989586621679497891"><span id="local-6989586621679497901"><span id="local-6989586621679497903"><span id="local-6989586621679497905"><span id="local-6989586621679497908"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#shift"><span class="hs-pragma hs-type">shift</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-494"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#bit"><span class="hs-pragma hs-type">bit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-495"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#testBit"><span class="hs-pragma hs-type">testBit</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-496"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#popCount"><span class="hs-pragma hs-type">popCount</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-497"></span><span>
</span><span id="line-498"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497887"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497887"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497886"><span class="annot"><span class="annottext">.&amp;. :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679497886"><span class="hs-operator hs-var hs-var hs-var hs-var">.&amp;.</span></a></span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497885"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497885"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497887"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#and%23"><span class="hs-operator hs-var">`and#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497885"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497884"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497884"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497883"><span class="annot"><span class="annottext">.|. :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679497883"><span class="hs-operator hs-var hs-var hs-var hs-var">.|.</span></a></span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497882"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497882"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497884"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#or%23"><span class="hs-operator hs-var">`or#`</span></a></span><span>  </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497882"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-500"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497881"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497881"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497880"><span class="annot"><span class="annottext">xor :: Word -&gt; Word -&gt; Word
</span><a href="#local-6989586621679497880"><span class="hs-operator hs-var hs-var hs-var hs-var">`xor`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497879"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497879"><span class="hs-identifier hs-var">y#</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497881"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#xor%23"><span class="hs-operator hs-var">`xor#`</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497879"><span class="hs-identifier hs-var">y#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span>    </span><span id="local-6989586621679497878"><span class="annot"><span class="annottext">complement :: Word -&gt; Word
</span><a href="#local-6989586621679497878"><span class="hs-identifier hs-var hs-var hs-var hs-var">complement</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497877"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497877"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#not%23"><span class="hs-identifier hs-var">not#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497877"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-502"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497876"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497876"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497875"><span class="annot"><span class="annottext">shift :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497875"><span class="hs-operator hs-var hs-var hs-var hs-var">`shift`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497874"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497874"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497874"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497876"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="GHC.Base.html#shiftL%23"><span class="hs-operator hs-var">`shiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497874"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-504"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497876"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="GHC.Base.html#shiftRL%23"><span class="hs-operator hs-var">`shiftRL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#negateInt%23"><span class="hs-identifier hs-var">negateInt#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497874"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-505"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497871"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497871"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497870"><span class="annot"><span class="annottext">shiftL :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497870"><span class="hs-operator hs-var hs-var hs-var hs-var">`shiftL`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497869"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497869"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-506"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497869"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497871"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="GHC.Base.html#shiftL%23"><span class="hs-operator hs-var">`shiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497869"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-507"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-508"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497868"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497868"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497867"><span class="annot"><span class="annottext">unsafeShiftL :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497867"><span class="hs-operator hs-var hs-var hs-var hs-var">`unsafeShiftL`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497866"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497866"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497868"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedShiftL%23"><span class="hs-operator hs-var">`uncheckedShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497866"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-509"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497865"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497865"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497864"><span class="annot"><span class="annottext">shiftR :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497864"><span class="hs-operator hs-var hs-var hs-var hs-var">`shiftR`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497863"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497863"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-510"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497863"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497865"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="GHC.Base.html#shiftRL%23"><span class="hs-operator hs-var">`shiftRL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497863"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-511"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-512"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497862"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497862"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497861"><span class="annot"><span class="annottext">unsafeShiftR :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497861"><span class="hs-operator hs-var hs-var hs-var hs-var">`unsafeShiftR`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497860"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497860"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497862"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedShiftRL%23"><span class="hs-operator hs-var">`uncheckedShiftRL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497860"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-513"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497859"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497859"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679497858"><span class="annot"><span class="annottext">rotate :: Word -&gt; Int -&gt; Word
</span><a href="#local-6989586621679497858"><span class="hs-operator hs-var hs-var hs-var hs-var">`rotate`</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497857"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497857"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-514"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497856"><span class="hs-identifier hs-var">i'#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3D%3D%23"><span class="hs-operator hs-var">==#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497859"><span class="hs-identifier hs-var">x#</span></a></span><span>
</span><span id="line-515"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word
</span><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-var">W#</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497859"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedShiftL%23"><span class="hs-operator hs-var">`uncheckedShiftL#`</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497856"><span class="hs-identifier hs-var">i'#</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#or%23"><span class="hs-operator hs-var">`or#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497859"><span class="hs-identifier hs-var">x#</span></a></span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#uncheckedShiftRL%23"><span class="hs-operator hs-var">`uncheckedShiftRL#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497855"><span class="hs-identifier hs-var">wsib</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497856"><span class="hs-identifier hs-var">i'#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-516"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679497856"><span class="annot"><span class="annottext">i'# :: Int#
</span><a href="#local-6989586621679497856"><span class="hs-identifier hs-var hs-var">i'#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497857"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#andI%23"><span class="hs-operator hs-var">`andI#`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497855"><span class="hs-identifier hs-var">wsib</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#-%23"><span class="hs-operator hs-var">-#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">1#</span></span><span class="hs-special">)</span><span>
</span><span id="line-518"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679497855"><span class="annot"><span class="annottext">wsib :: Int#
</span><a href="#local-6989586621679497855"><span class="hs-identifier hs-var hs-var">wsib</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WORD_SIZE_IN_BITS#</span><span>  </span><span class="hs-comment">{- work around preprocessor problem (??) -}</span><span>
</span><span id="line-519"></span><span>    </span><span id="local-6989586621679497852"><span class="annot"><span class="annottext">bitSizeMaybe :: Word -&gt; Maybe Int
</span><a href="#local-6989586621679497852"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSizeMaybe</span></a></span></span><span> </span><span id="local-6989586621679497851"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679497851"><span class="hs-identifier hs-var">i</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679497851"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-520"></span><span>    </span><span id="local-6989586621679497849"><span class="annot"><span class="annottext">bitSize :: Word -&gt; Int
</span><a href="#local-6989586621679497849"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSize</span></a></span></span><span> </span><span id="local-6989586621679497848"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679497848"><span class="hs-identifier hs-var">i</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Int
forall b. FiniteBits b =&gt; b -&gt; Int
</span><a href="Data.Bits.html#finiteBitSize"><span class="hs-identifier hs-var">finiteBitSize</span></a></span><span> </span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621679497848"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-521"></span><span>    </span><span id="local-6989586621679497847"><span class="annot"><span class="annottext">isSigned :: Word -&gt; Bool
</span><a href="#local-6989586621679497847"><span class="hs-identifier hs-var hs-var hs-var hs-var">isSigned</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-522"></span><span>    </span><span id="local-6989586621679497846"><span class="annot"><span class="annottext">popCount :: Word -&gt; Int
</span><a href="#local-6989586621679497846"><span class="hs-identifier hs-var hs-var hs-var hs-var">popCount</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497845"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497845"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#popCnt%23"><span class="hs-identifier hs-var">popCnt#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497845"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-523"></span><span>    </span><span id="local-6989586621679497841"><span class="annot"><span class="annottext">bit :: Int -&gt; Word
</span><a href="#local-6989586621679497841"><span class="hs-identifier hs-var hs-var hs-var hs-var">bit</span></a></span></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word
forall a. (Bits a, Num a) =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bitDefault"><span class="hs-identifier hs-var">bitDefault</span></a></span><span>
</span><span id="line-524"></span><span>    </span><span id="local-6989586621679497838"><span class="annot"><span class="annottext">testBit :: Word -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679497838"><span class="hs-identifier hs-var hs-var hs-var hs-var">testBit</span></a></span></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word -&gt; Int -&gt; Bool
forall a. (Bits a, Num a) =&gt; a -&gt; Int -&gt; Bool
</span><a href="Data.Bits.html#testBitDefault"><span class="hs-identifier hs-var">testBitDefault</span></a></span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span class="hs-comment">-- | @since 4.6.0.0</span><span>
</span><span id="line-527"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Data.Bits.html#FiniteBits"><span class="hs-identifier hs-type">FiniteBits</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier hs-type">Word</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-528"></span><span>    </span><span id="local-6989586621679497832"><span class="annot"><span class="annottext">finiteBitSize :: Word -&gt; Int
</span><a href="#local-6989586621679497832"><span class="hs-identifier hs-var hs-var hs-var hs-var">finiteBitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Word
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WORD_SIZE_IN_BITS</span><span>
</span><span id="line-529"></span><span>    </span><span id="local-6989586621679497831"><span class="annot"><span class="annottext">countLeadingZeros :: Word -&gt; Int
</span><a href="#local-6989586621679497831"><span class="hs-identifier hs-var hs-var hs-var hs-var">countLeadingZeros</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497830"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497830"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#clz%23"><span class="hs-identifier hs-var">clz#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497830"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-530"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#countLeadingZeros"><span class="hs-pragma hs-type">countLeadingZeros</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-531"></span><span>    </span><span id="local-6989586621679497829"><span class="annot"><span class="annottext">countTrailingZeros :: Word -&gt; Int
</span><a href="#local-6989586621679497829"><span class="hs-identifier hs-var hs-var hs-var hs-var">countTrailingZeros</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#W%23"><span class="hs-identifier hs-type">W#</span></a></span><span> </span><span id="local-6989586621679497828"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497828"><span class="hs-identifier hs-var">x#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#ctz%23"><span class="hs-identifier hs-var">ctz#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679497828"><span class="hs-identifier hs-var">x#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-532"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#countTrailingZeros"><span class="hs-pragma hs-type">countTrailingZeros</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-533"></span><span>
</span><span id="line-534"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-535"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679497799"><span id="local-6989586621679497801"><span id="local-6989586621679497811"><span id="local-6989586621679497813"><span id="local-6989586621679497815"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier hs-type">Integer</span></a></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-536"></span><span>   </span><span id="local-6989586621679497797"><span class="annot"><span class="annottext">.&amp;. :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679497797"><span class="hs-operator hs-var hs-var hs-var hs-var">(.&amp;.)</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerAnd"><span class="hs-identifier hs-var">integerAnd</span></a></span><span>
</span><span id="line-537"></span><span>   </span><span id="local-6989586621679497796"><span class="annot"><span class="annottext">.|. :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679497796"><span class="hs-operator hs-var hs-var hs-var hs-var">(.|.)</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerOr"><span class="hs-identifier hs-var">integerOr</span></a></span><span>
</span><span id="line-538"></span><span>   </span><span id="local-6989586621679497795"><span class="annot"><span class="annottext">xor :: Integer -&gt; Integer -&gt; Integer
</span><a href="#local-6989586621679497795"><span class="hs-identifier hs-var hs-var hs-var hs-var">xor</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerXor"><span class="hs-identifier hs-var">integerXor</span></a></span><span>
</span><span id="line-539"></span><span>   </span><span id="local-6989586621679497794"><span class="annot"><span class="annottext">complement :: Integer -&gt; Integer
</span><a href="#local-6989586621679497794"><span class="hs-identifier hs-var hs-var hs-var hs-var">complement</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerComplement"><span class="hs-identifier hs-var">integerComplement</span></a></span><span>
</span><span id="line-540"></span><span>   </span><span id="local-6989586621679497790"><span class="annot"><span class="annottext">unsafeShiftR :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497790"><span class="hs-identifier hs-var hs-var hs-var hs-var">unsafeShiftR</span></a></span></span><span> </span><span id="local-6989586621679497789"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497789"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497788"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497788"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftR"><span class="hs-identifier hs-var">integerShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497789"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497788"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-541"></span><span>   </span><span id="local-6989586621679497784"><span class="annot"><span class="annottext">unsafeShiftL :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497784"><span class="hs-identifier hs-var hs-var hs-var hs-var">unsafeShiftL</span></a></span></span><span> </span><span id="local-6989586621679497783"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497783"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497782"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497782"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL"><span class="hs-identifier hs-var">integerShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497783"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497782"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>   </span><span id="local-6989586621679497779"><span class="annot"><span class="annottext">shiftR :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497779"><span class="hs-identifier hs-var hs-var hs-var hs-var">shiftR</span></a></span></span><span> </span><span id="local-6989586621679497778"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497778"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497777"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679497777"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497776"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497776"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-543"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497776"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Integer
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#unsafeShiftR"><span class="hs-identifier hs-var">unsafeShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497778"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497777"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-544"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-545"></span><span>   </span><span id="local-6989586621679497774"><span class="annot"><span class="annottext">shiftL :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497774"><span class="hs-identifier hs-var hs-var hs-var hs-var">shiftL</span></a></span></span><span> </span><span id="local-6989586621679497773"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497773"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497772"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679497772"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497771"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497771"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-546"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497771"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Integer
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#unsafeShiftL"><span class="hs-identifier hs-var">unsafeShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497773"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497772"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-547"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-548"></span><span>   </span><span id="local-6989586621679497763"><span class="annot"><span class="annottext">shift :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497763"><span class="hs-identifier hs-var hs-var hs-var hs-var">shift</span></a></span></span><span> </span><span id="local-6989586621679497762"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497762"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497761"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497761"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497761"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftL"><span class="hs-identifier hs-var">integerShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497762"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497761"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-549"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerShiftR"><span class="hs-identifier hs-var">integerShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497762"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497761"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-550"></span><span>   </span><span id="local-6989586621679497758"><span class="annot"><span class="annottext">testBit :: Integer -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679497758"><span class="hs-identifier hs-var hs-var hs-var hs-var">testBit</span></a></span></span><span> </span><span id="local-6989586621679497757"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497757"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497756"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497756"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Word -&gt; Bool
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerTestBit"><span class="hs-identifier hs-var">integerTestBit</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497757"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497756"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-551"></span><span>   </span><span id="local-6989586621679497754"><span class="annot"><span class="annottext">zeroBits :: Integer
</span><a href="#local-6989586621679497754"><span class="hs-identifier hs-var hs-var hs-var hs-var">zeroBits</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerZero"><span class="hs-identifier hs-var">integerZero</span></a></span><span>
</span><span id="line-552"></span><span>
</span><span id="line-553"></span><span>   </span><span id="local-6989586621679497752"><span class="annot"><span class="annottext">bit :: Int -&gt; Integer
</span><a href="#local-6989586621679497752"><span class="hs-identifier hs-var hs-var hs-var hs-var">bit</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497751"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497751"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Integer
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerBit%23"><span class="hs-identifier hs-var">integerBit#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497751"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-554"></span><span>   </span><span id="local-6989586621679497750"><span class="annot"><span class="annottext">popCount :: Integer -&gt; Int
</span><a href="#local-6989586621679497750"><span class="hs-identifier hs-var hs-var hs-var hs-var">popCount</span></a></span></span><span> </span><span id="local-6989586621679497749"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497749"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int#
</span><a href="../../ghc-bignum/src/GHC.Num.Integer.html#integerPopCount%23"><span class="hs-identifier hs-var">integerPopCount#</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497749"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span>   </span><span id="local-6989586621679497747"><span class="annot"><span class="annottext">rotate :: Integer -&gt; Int -&gt; Integer
</span><a href="#local-6989586621679497747"><span class="hs-identifier hs-var hs-var hs-var hs-var">rotate</span></a></span></span><span> </span><span id="local-6989586621679497746"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497746"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497745"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497745"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Integer
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shift"><span class="hs-identifier hs-var">shift</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679497746"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497745"><span class="hs-identifier hs-var">i</span></a></span><span>   </span><span class="hs-comment">-- since an Integer never wraps around</span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>   </span><span id="local-6989586621679497744"><span class="annot"><span class="annottext">bitSizeMaybe :: Integer -&gt; Maybe Int
</span><a href="#local-6989586621679497744"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSizeMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-559"></span><span>   </span><span id="local-6989586621679497743"><span class="annot"><span class="annottext">bitSize :: Integer -&gt; Int
</span><a href="#local-6989586621679497743"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Int
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Data.Bits.bitSize(Integer)&quot;</span></span><span>
</span><span id="line-560"></span><span>   </span><span id="local-6989586621679497741"><span class="annot"><span class="annottext">isSigned :: Integer -&gt; Bool
</span><a href="#local-6989586621679497741"><span class="hs-identifier hs-var hs-var hs-var hs-var">isSigned</span></a></span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-561"></span><span>
</span><span id="line-562"></span><span class="hs-comment">-- | @since 4.8.0</span><span>
</span><span id="line-563"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679497713"><span id="local-6989586621679497715"><span id="local-6989586621679497725"><span id="local-6989586621679497728"><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Natural.html#Natural"><span class="hs-identifier hs-type">Natural</span></a></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-564"></span><span>   </span><span id="local-6989586621679497711"><span class="annot"><span class="annottext">.&amp;. :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679497711"><span class="hs-operator hs-var hs-var hs-var hs-var">(.&amp;.)</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalAnd"><span class="hs-identifier hs-var">naturalAnd</span></a></span><span>
</span><span id="line-565"></span><span>   </span><span id="local-6989586621679497710"><span class="annot"><span class="annottext">.|. :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679497710"><span class="hs-operator hs-var hs-var hs-var hs-var">(.|.)</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalOr"><span class="hs-identifier hs-var">naturalOr</span></a></span><span>
</span><span id="line-566"></span><span>   </span><span id="local-6989586621679497709"><span class="annot"><span class="annottext">xor :: Natural -&gt; Natural -&gt; Natural
</span><a href="#local-6989586621679497709"><span class="hs-identifier hs-var hs-var hs-var hs-var">xor</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalXor"><span class="hs-identifier hs-var">naturalXor</span></a></span><span>
</span><span id="line-567"></span><span>   </span><span id="local-6989586621679497708"><span class="annot"><span class="annottext">complement :: Natural -&gt; Natural
</span><a href="#local-6989586621679497708"><span class="hs-identifier hs-var hs-var hs-var hs-var">complement</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Natural
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span>
</span><span id="line-568"></span><span>                    </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Bits.complement: Natural complement undefined&quot;</span></span><span>
</span><span id="line-569"></span><span>   </span><span id="local-6989586621679497705"><span class="annot"><span class="annottext">unsafeShiftR :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497705"><span class="hs-identifier hs-var hs-var hs-var hs-var">unsafeShiftR</span></a></span></span><span> </span><span id="local-6989586621679497704"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497704"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497703"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497703"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Word -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalShiftR"><span class="hs-identifier hs-var">naturalShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497704"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497703"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-570"></span><span>   </span><span id="local-6989586621679497699"><span class="annot"><span class="annottext">unsafeShiftL :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497699"><span class="hs-identifier hs-var hs-var hs-var hs-var">unsafeShiftL</span></a></span></span><span> </span><span id="local-6989586621679497698"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497698"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497697"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497697"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Word -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalShiftL"><span class="hs-identifier hs-var">naturalShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497698"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497697"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>   </span><span id="local-6989586621679497694"><span class="annot"><span class="annottext">shiftR :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497694"><span class="hs-identifier hs-var hs-var hs-var hs-var">shiftR</span></a></span></span><span> </span><span id="local-6989586621679497693"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497693"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497692"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679497692"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497691"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497691"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-572"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497691"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Int -&gt; Natural
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#unsafeShiftR"><span class="hs-identifier hs-var">unsafeShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497693"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497692"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-573"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-574"></span><span>   </span><span id="local-6989586621679497689"><span class="annot"><span class="annottext">shiftL :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497689"><span class="hs-identifier hs-var hs-var hs-var hs-var">shiftL</span></a></span></span><span> </span><span id="local-6989586621679497688"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497688"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497687"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679497687"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497686"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497686"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-575"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#isTrue%23"><span class="hs-identifier hs-var">isTrue#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497686"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#%3E%3D%23"><span class="hs-operator hs-var">&gt;=#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Int -&gt; Natural
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#unsafeShiftL"><span class="hs-identifier hs-var">unsafeShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497688"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497687"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-576"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
forall a. a
</span><a href="GHC.Real.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span>
</span><span id="line-577"></span><span>   </span><span id="local-6989586621679497678"><span class="annot"><span class="annottext">shift :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497678"><span class="hs-identifier hs-var hs-var hs-var hs-var">shift</span></a></span></span><span> </span><span id="local-6989586621679497677"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497677"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497676"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497676"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-578"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497676"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Word -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalShiftL"><span class="hs-identifier hs-var">naturalShiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497677"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497676"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-579"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Word -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalShiftR"><span class="hs-identifier hs-var">naturalShiftR</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497677"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497676"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-580"></span><span>   </span><span id="local-6989586621679497673"><span class="annot"><span class="annottext">testBit :: Natural -&gt; Int -&gt; Bool
</span><a href="#local-6989586621679497673"><span class="hs-identifier hs-var hs-var hs-var hs-var">testBit</span></a></span></span><span> </span><span id="local-6989586621679497672"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497672"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497671"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497671"><span class="hs-identifier hs-var">i</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Word -&gt; Bool
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalTestBit"><span class="hs-identifier hs-var">naturalTestBit</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497672"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497671"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>   </span><span id="local-6989586621679497669"><span class="annot"><span class="annottext">zeroBits :: Natural
</span><a href="#local-6989586621679497669"><span class="hs-identifier hs-var hs-var hs-var hs-var">zeroBits</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalZero"><span class="hs-identifier hs-var">naturalZero</span></a></span><span>
</span><span id="line-582"></span><span>   </span><span id="local-6989586621679497664"><span class="annot"><span class="annottext">clearBit :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497664"><span class="hs-identifier hs-var hs-var hs-var hs-var">clearBit</span></a></span></span><span> </span><span id="local-6989586621679497663"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497663"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497662"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497662"><span class="hs-identifier hs-var">i</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497663"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#xor"><span class="hs-operator hs-var">`xor`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Natural
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497662"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Natural -&gt; Natural
forall a. Bits a =&gt; a -&gt; a -&gt; a
</span><a href="Data.Bits.html#.%26."><span class="hs-operator hs-var">.&amp;.</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497663"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span>   </span><span id="local-6989586621679497661"><span class="annot"><span class="annottext">bit :: Int -&gt; Natural
</span><a href="#local-6989586621679497661"><span class="hs-identifier hs-var hs-var hs-var hs-var">bit</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679497660"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497660"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Natural
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalBit%23"><span class="hs-identifier hs-var">naturalBit#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#int2Word%23"><span class="hs-identifier hs-var">int2Word#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679497660"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>   </span><span id="local-6989586621679497659"><span class="annot"><span class="annottext">popCount :: Natural -&gt; Int
</span><a href="#local-6989586621679497659"><span class="hs-identifier hs-var hs-var hs-var hs-var">popCount</span></a></span></span><span> </span><span id="local-6989586621679497658"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497658"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#word2Int%23"><span class="hs-identifier hs-var">word2Int#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Natural -&gt; Word#
</span><a href="../../ghc-bignum/src/GHC.Num.Natural.html#naturalPopCount%23"><span class="hs-identifier hs-var">naturalPopCount#</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497658"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span>   </span><span id="local-6989586621679497656"><span class="annot"><span class="annottext">rotate :: Natural -&gt; Int -&gt; Natural
</span><a href="#local-6989586621679497656"><span class="hs-identifier hs-var hs-var hs-var hs-var">rotate</span></a></span></span><span> </span><span id="local-6989586621679497655"><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497655"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497654"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497654"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Natural -&gt; Int -&gt; Natural
forall a. Bits a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Bits.html#shift"><span class="hs-identifier hs-var">shift</span></a></span><span> </span><span class="annot"><span class="annottext">Natural
</span><a href="#local-6989586621679497655"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497654"><span class="hs-identifier hs-var">i</span></a></span><span>   </span><span class="hs-comment">-- since an Natural never wraps around</span><span>
</span><span id="line-588"></span><span>
</span><span id="line-589"></span><span>   </span><span id="local-6989586621679497653"><span class="annot"><span class="annottext">bitSizeMaybe :: Natural -&gt; Maybe Int
</span><a href="#local-6989586621679497653"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSizeMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-590"></span><span>   </span><span id="local-6989586621679497652"><span class="annot"><span class="annottext">bitSize :: Natural -&gt; Int
</span><a href="#local-6989586621679497652"><span class="hs-identifier hs-var hs-var hs-var hs-var">bitSize</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Int
forall a. [Char] -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Data.Bits.bitSize(Natural)&quot;</span></span><span>
</span><span id="line-591"></span><span>   </span><span id="local-6989586621679497651"><span class="annot"><span class="annottext">isSigned :: Natural -&gt; Bool
</span><a href="#local-6989586621679497651"><span class="hs-identifier hs-var hs-var hs-var hs-var">isSigned</span></a></span></span><span> </span><span class="annot"><span class="annottext">Natural
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-592"></span><span>
</span><span id="line-593"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span class="hs-comment">-- | Attempt to convert an 'Integral' type @a@ to an 'Integral' type @b@ using</span><span>
</span><span id="line-596"></span><span class="hs-comment">-- the size of the types as measured by 'Bits' methods.</span><span>
</span><span id="line-597"></span><span class="hs-comment">--</span><span>
</span><span id="line-598"></span><span class="hs-comment">-- A simpler version of this function is:</span><span>
</span><span id="line-599"></span><span class="hs-comment">--</span><span>
</span><span id="line-600"></span><span class="hs-comment">-- &gt; toIntegral :: (Integral a, Integral b) =&gt; a -&gt; Maybe b</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- &gt; toIntegral x</span><span>
</span><span id="line-602"></span><span class="hs-comment">-- &gt;   | toInteger x == y = Just (fromInteger y)</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- &gt;   | otherwise        = Nothing</span><span>
</span><span id="line-604"></span><span class="hs-comment">-- &gt;   where</span><span>
</span><span id="line-605"></span><span class="hs-comment">-- &gt;     y = toInteger x</span><span>
</span><span id="line-606"></span><span class="hs-comment">--</span><span>
</span><span id="line-607"></span><span class="hs-comment">-- This version requires going through 'Integer', which can be inefficient.</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- However, @toIntegralSized@ is optimized to allow GHC to statically determine</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- the relative type sizes (as measured by 'bitSizeMaybe' and 'isSigned') and</span><span>
</span><span id="line-610"></span><span class="hs-comment">-- avoid going through 'Integer' for many types. (The implementation uses</span><span>
</span><span id="line-611"></span><span class="hs-comment">-- 'fromIntegral', which is itself optimized with rules for @base@ types but may</span><span>
</span><span id="line-612"></span><span class="hs-comment">-- go through 'Integer' for some type pairs.)</span><span>
</span><span id="line-613"></span><span class="hs-comment">--</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- @since 4.8.0.0</span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span id="local-6989586621679498307"><span id="local-6989586621679498308"><span class="annot"><a href="Data.Bits.html#toIntegralSized"><span class="hs-identifier hs-type">toIntegralSized</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498308"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498307"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498308"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498307"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498308"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498307"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-617"></span><span id="toIntegralSized"><span class="annot"><span class="annottext">toIntegralSized :: forall a b.
(Integral a, Integral b, Bits a, Bits b) =&gt;
a -&gt; Maybe b
</span><a href="Data.Bits.html#toIntegralSized"><span class="hs-identifier hs-var hs-var">toIntegralSized</span></a></span></span><span> </span><span id="local-6989586621679497636"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span></span><span>                 </span><span class="hs-comment">-- See Note [toIntegralSized optimization]</span><span>
</span><span id="line-618"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; (a -&gt; Bool) -&gt; Maybe a -&gt; Bool
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679497633"><span class="hs-identifier hs-var">yMinBound</span></a></span><span>
</span><span id="line-619"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; (a -&gt; Bool) -&gt; Maybe a -&gt; Bool
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679497632"><span class="hs-identifier hs-var">yMaxBound</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Maybe b
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-620"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe b
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-621"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-622"></span><span>    </span><span id="local-6989586621679497631"><span class="annot"><span class="annottext">y :: b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span>    </span><span id="local-6989586621679497627"><span class="annot"><span class="annottext">xWidth :: Maybe Int
</span><a href="#local-6989586621679497627"><span class="hs-identifier hs-var hs-var">xWidth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe Int
forall a. Bits a =&gt; a -&gt; Maybe Int
</span><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-var">bitSizeMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-625"></span><span>    </span><span id="local-6989586621679497625"><span class="annot"><span class="annottext">yWidth :: Maybe Int
</span><a href="#local-6989586621679497625"><span class="hs-identifier hs-var hs-var">yWidth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Maybe Int
forall a. Bits a =&gt; a -&gt; Maybe Int
</span><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-var">bitSizeMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-626"></span><span>
</span><span id="line-627"></span><span>    </span><span id="local-6989586621679497633"><span class="annot"><span class="annottext">yMinBound :: Maybe a
</span><a href="#local-6989586621679497633"><span class="hs-identifier hs-var hs-var">yMinBound</span></a></span></span><span>
</span><span id="line-628"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
forall a b. (Bits a, Bits b) =&gt; a -&gt; b -&gt; Bool
</span><a href="Data.Bits.html#isBitSubType"><span class="hs-identifier hs-var">isBitSubType</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-629"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-630"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-631"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497612"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497612"><span class="hs-identifier hs-var">yW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497625"><span class="hs-identifier hs-var">yWidth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; a -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497612"><span class="hs-identifier hs-var">yW</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Assumes sub-type</span><span>
</span><span id="line-632"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-633"></span><span>
</span><span id="line-634"></span><span>    </span><span id="local-6989586621679497632"><span class="annot"><span class="annottext">yMaxBound :: Maybe a
</span><a href="#local-6989586621679497632"><span class="hs-identifier hs-var hs-var">yMaxBound</span></a></span></span><span>
</span><span id="line-635"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Bool
forall a b. (Bits a, Bits b) =&gt; a -&gt; b -&gt; Bool
</span><a href="Data.Bits.html#isBitSubType"><span class="hs-identifier hs-var">isBitSubType</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-636"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497636"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-637"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497595"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497595"><span class="hs-identifier hs-var">xW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497627"><span class="hs-identifier hs-var">xWidth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497594"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497594"><span class="hs-identifier hs-var">yW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497625"><span class="hs-identifier hs-var">yWidth</span></a></span><span>
</span><span id="line-638"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497595"><span class="hs-identifier hs-var">xW</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497594"><span class="hs-identifier hs-var">yW</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-comment">-- Max bound beyond a's domain</span><span>
</span><span id="line-639"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497593"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497593"><span class="hs-identifier hs-var">yW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497625"><span class="hs-identifier hs-var">yWidth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497631"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-640"></span><span>                            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497593"><span class="hs-identifier hs-var">yW</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-641"></span><span>                            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Bits a =&gt; Int -&gt; a
</span><a href="Data.Bits.html#bit"><span class="hs-identifier hs-var">bit</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497593"><span class="hs-identifier hs-var">yW</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-642"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-643"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Bits.html#toIntegralSized"><span class="hs-pragma hs-type">toIntegralSized</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span class="hs-comment">-- | 'True' if the size of @a@ is @&lt;=@ the size of @b@, where size is measured</span><span>
</span><span id="line-646"></span><span class="hs-comment">-- by 'bitSizeMaybe' and 'isSigned'.</span><span>
</span><span id="line-647"></span><span id="local-6989586621679498299"><span id="local-6989586621679498300"><span class="annot"><a href="Data.Bits.html#isBitSubType"><span class="hs-identifier hs-type">isBitSubType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498300"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Bits.html#Bits"><span class="hs-identifier hs-type">Bits</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679498299"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498300"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679498299"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span></span><span>
</span><span id="line-648"></span><span id="isBitSubType"><span class="annot"><span class="annottext">isBitSubType :: forall a b. (Bits a, Bits b) =&gt; a -&gt; b -&gt; Bool
</span><a href="Data.Bits.html#isBitSubType"><span class="hs-identifier hs-var hs-var">isBitSubType</span></a></span></span><span> </span><span id="local-6989586621679497581"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497581"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679497580"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497580"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-649"></span><span>  </span><span class="hs-comment">-- Reflexive</span><span>
</span><span id="line-650"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497579"><span class="hs-identifier hs-var">xWidth</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int -&gt; Maybe Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var">yWidth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497577"><span class="hs-identifier hs-var">xSigned</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var">ySigned</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-651"></span><span>
</span><span id="line-652"></span><span>  </span><span class="hs-comment">-- Every integer is a subset of 'Integer'</span><span>
</span><span id="line-653"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var">ySigned</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int -&gt; Maybe Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var">yWidth</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-654"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497577"><span class="hs-identifier hs-var">xSigned</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var">ySigned</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int -&gt; Maybe Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var">yWidth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-655"></span><span>
</span><span id="line-656"></span><span>  </span><span class="hs-comment">-- Sub-type relations between fixed-with types</span><span>
</span><span id="line-657"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497577"><span class="hs-identifier hs-var">xSigned</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var">ySigned</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497575"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497575"><span class="hs-identifier hs-var">xW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497579"><span class="hs-identifier hs-var">xWidth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497574"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497574"><span class="hs-identifier hs-var">yW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var">yWidth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497575"><span class="hs-identifier hs-var">xW</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497574"><span class="hs-identifier hs-var">yW</span></a></span><span>
</span><span id="line-658"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497577"><span class="hs-identifier hs-var">xSigned</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var">ySigned</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497573"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497573"><span class="hs-identifier hs-var">xW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497579"><span class="hs-identifier hs-var">xWidth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679497572"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497572"><span class="hs-identifier hs-var">yW</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var">yWidth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497573"><span class="hs-identifier hs-var">xW</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679497572"><span class="hs-identifier hs-var">yW</span></a></span><span>
</span><span id="line-659"></span><span>
</span><span id="line-660"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-661"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-662"></span><span>    </span><span id="local-6989586621679497579"><span class="annot"><span class="annottext">xWidth :: Maybe Int
</span><a href="#local-6989586621679497579"><span class="hs-identifier hs-var hs-var">xWidth</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe Int
forall a. Bits a =&gt; a -&gt; Maybe Int
</span><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-var">bitSizeMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497581"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-663"></span><span>    </span><span id="local-6989586621679497577"><span class="annot"><span class="annottext">xSigned :: Bool
</span><a href="#local-6989586621679497577"><span class="hs-identifier hs-var hs-var">xSigned</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span>     </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679497581"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-664"></span><span>
</span><span id="line-665"></span><span>    </span><span id="local-6989586621679497578"><span class="annot"><span class="annottext">yWidth :: Maybe Int
</span><a href="#local-6989586621679497578"><span class="hs-identifier hs-var hs-var">yWidth</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Maybe Int
forall a. Bits a =&gt; a -&gt; Maybe Int
</span><a href="Data.Bits.html#bitSizeMaybe"><span class="hs-identifier hs-var">bitSizeMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497580"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-666"></span><span>    </span><span id="local-6989586621679497576"><span class="annot"><span class="annottext">ySigned :: Bool
</span><a href="#local-6989586621679497576"><span class="hs-identifier hs-var hs-var">ySigned</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bool
forall a. Bits a =&gt; a -&gt; Bool
</span><a href="Data.Bits.html#isSigned"><span class="hs-identifier hs-var">isSigned</span></a></span><span>     </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679497580"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-667"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Bits.html#isBitSubType"><span class="hs-pragma hs-type">isBitSubType</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-668"></span><span>
</span><span id="line-669"></span><span class="hs-comment">{-      Note [Constant folding for rotate]
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The INLINE on the Int instance of rotate enables it to be constant
folded.  For example:
     sumU . mapU (`rotate` 3) . replicateU 10000000 $ (7 :: Int)
goes to:
   Main.$wfold =
     \ (ww_sO7 :: Int#) (ww1_sOb :: Int#) -&gt;
       case ww1_sOb of wild_XM {
         __DEFAULT -&gt; Main.$wfold (+# ww_sO7 56) (+# wild_XM 1);
         10000000 -&gt; ww_sO7
whereas before it was left as a call to $wrotate.

All other Bits instances seem to inline well enough on their
own to enable constant folding; for example 'shift':
     sumU . mapU (`shift` 3) . replicateU 10000000 $ (7 :: Int)
 goes to:
     Main.$wfold =
       \ (ww_sOb :: Int#) (ww1_sOf :: Int#) -&gt;
         case ww1_sOf of wild_XM {
           __DEFAULT -&gt; Main.$wfold (+# ww_sOb 56) (+# wild_XM 1);
           10000000 -&gt; ww_sOb
         }
-}</span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span class="hs-comment">-- Note [toIntegralSized optimization]</span><span>
</span><span id="line-695"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-696"></span><span class="hs-comment">-- The code in 'toIntegralSized' relies on GHC optimizing away statically</span><span>
</span><span id="line-697"></span><span class="hs-comment">-- decidable branches.</span><span>
</span><span id="line-698"></span><span class="hs-comment">--</span><span>
</span><span id="line-699"></span><span class="hs-comment">-- If both integral types are statically known, GHC will be able optimize the</span><span>
</span><span id="line-700"></span><span class="hs-comment">-- code significantly (for @-O1@ and better).</span><span>
</span><span id="line-701"></span><span class="hs-comment">--</span><span>
</span><span id="line-702"></span><span class="hs-comment">-- For instance (as of GHC 7.8.1) the following definitions:</span><span>
</span><span id="line-703"></span><span class="hs-comment">--</span><span>
</span><span id="line-704"></span><span class="hs-comment">-- &gt; w16_to_i32 = toIntegralSized :: Word16 -&gt; Maybe Int32</span><span>
</span><span id="line-705"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-706"></span><span class="hs-comment">-- &gt; i16_to_w16 = toIntegralSized :: Int16 -&gt; Maybe Word16</span><span>
</span><span id="line-707"></span><span class="hs-comment">--</span><span>
</span><span id="line-708"></span><span class="hs-comment">-- are translated into the following (simplified) /GHC Core/ language:</span><span>
</span><span id="line-709"></span><span class="hs-comment">--</span><span>
</span><span id="line-710"></span><span class="hs-comment">-- &gt; w16_to_i32 = \x -&gt; Just (case x of _ { W16# x# -&gt; I32# (word2Int# x#) })</span><span>
</span><span id="line-711"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-712"></span><span class="hs-comment">-- &gt; i16_to_w16 = \x -&gt; case eta of _</span><span>
</span><span id="line-713"></span><span class="hs-comment">-- &gt;   { I16# b1 -&gt; case tagToEnum# (&lt;=# 0 b1) of _</span><span>
</span><span id="line-714"></span><span class="hs-comment">-- &gt;       { False -&gt; Nothing</span><span>
</span><span id="line-715"></span><span class="hs-comment">-- &gt;       ; True -&gt; Just (W16# (narrow16Word# (int2Word# b1)))</span><span>
</span><span id="line-716"></span><span class="hs-comment">-- &gt;       }</span><span>
</span><span id="line-717"></span><span class="hs-comment">-- &gt;   }</span><span>
</span><span id="line-718"></span></pre></body></html>